#include <ObjectProperties.h>


ObjectProperties::ObjectProperties()
{
}

ObjectProperties::~ObjectProperties()
{
}

void ObjectProperties::AddProperty(const std::string& prop_name, float default_value)
{
	if( properties.find( prop_name ) == properties.end() )
		properties[ prop_name ] = default_value;
}

void ObjectProperties::RemoveProperty(const std::string& prop_name)
{
	if( properties.find( prop_name ) != properties.end() )
		properties.erase( prop_name );
}

truth ObjectProperties::HasProperty(const std::string& prop_name)
{
	if( properties.find( prop_name ) != properties.end() )
		return 1;
	return 0;
}

float ObjectProperties::GetProperty(const std::string& prop_name)
{
	if( properties.find( prop_name ) != properties.end() )
		return properties[ prop_name ];
	float nan1 = 0.0f;
	float nan2 = 0.0f;
	return (nan1/nan2);
}

void ObjectProperties::SetProperty(const std::string& prop_name, float new_value)
{
	if( properties.find( prop_name ) != properties.end() )
		properties[ prop_name ] = new_value;
}

void ObjectProperties::ModifyProperty(const std::string& prop_name, float mod_value)
{
	if( properties.find( prop_name ) != properties.end() )
		properties[ prop_name ] += mod_value;
}



void ObjectProperties::AddFlag(const std::string& flag_name, truth default_value)
{
	if( flags.find( flag_name ) == flags.end() )
		flags[ flag_name ] = default_value;
}

void ObjectProperties::RemoveFlag(const std::string& flag_name)
{
	if( flags.find( flag_name ) != flags.end() )
		flags.erase( flag_name );
}

truth ObjectProperties::HasFlag(const std::string& flag_name)
{
	if( flags.find( flag_name ) != flags.end() )
		return 1;
	return 0;
}

truth ObjectProperties::GetFlag(const std::string& flag_name)
{
	if( flags.find( flag_name ) != flags.end() )
		return flags[ flag_name ];
	return 0;
}

void ObjectProperties::SetFlag(const std::string& flag_name, truth new_value)
{
	if( flags.find( flag_name ) != flags.end() )
		flags[ flag_name ] = new_value;
}

void ObjectProperties::ToggleFlag(const std::string& flag_name)
{
	if( flags.find( flag_name ) != flags.end() )
		flags[ flag_name ] = (flags[ flag_name ] ? 0 : 1);
}